\chapter{Application Programming Interface (API)}
\label{api}

The \module{aspen} library exposes a number of objects. Here we document those
that are probably most useful.


\section{Applications}
\label {api-apps}

Aspen applications are WSGI callables that are intended to be associated with a
single directory via the \file{apps.conf} file. Aspen comes bundled with the
following applications, in the \module{aspen.apps} subpackage.


\subsection{\class{django_}}
\label{api-apps-django}

Aspen includes glue code for the Django web framework. In order to use this
feature, you must install Django for your site:

\begin{itemize}
\item{Put \module{django} on your \envvar{PYTHONPATH} (e.g., in \file{__/lib/python}).}
\item{Put your Django project on your \envvar{PYTHONPATH} (e.g., in \file{__/lib/python}).}
\item{Add a \code{[django]} section to \file{aspen.conf}, with a \var{settings_module} setting that points to your \module{settings} module.}
\item{Configure your Django project's \file{settings} module.}
\end{itemize}

The \module{aspen.apps.django_} module defines one function:

\begin{funcdesc}{wsgi}{environ, start_response}
This is Django's \class{WSGIHandler} callable.
\end{funcdesc}

\subsection{\class{static}}
\label{api-apps-static}

The \module{aspen.apps.static} module defines one function:

\begin{funcdesc}{wsgi}{environ, start_response} This application translates the
request path to the filesystem, locates any default resource for directories
(per the value of \var{defaults} in \file{aspen.conf}), and hands off to
\code{aspen.handlers.static.wsgi}. \end{funcdesc}
